<template>
	<view>
		<uni-section title="物品管理" type="line" padding>
			<uni-grid :column="4" :show-border="false" :square="false" @change="change">
				<uni-grid-item v-for="(item ,index) in list" :index="index" :key="index">
					<view class="grid-item-box">
						<roc-icon-plus :name="item.icon" :size="30" color="#674cff" class="item-icon"></roc-icon-plus>
						<text class="text">{{item.text}}</text>
						<view v-if="item.badge" class="grid-dot">
							<uni-badge :text="item.badge" type="warning" />
						</view>
					</view>
				</uni-grid-item>
			</uni-grid>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					// {
					// 	icon: '/static/icon/itemapply.png',
					// 	text: '新增分类',
					// 	url: '/pagesA/item/categories/add'
					// }, 
					{
						icon: 'box-archive',
						text: '管理分类',
						url: '/pagesA/item/categories/list'
					},
					// {
					// 	icon: '/static/icon/itemapply.png',
					// 	text: '物品入库',
					// 	url: '/pagesA/item/goods/add'
					// }, 
					{
						icon: 'box-archive',
						text: '管理物品',
						url: '/pagesA/item/goods/list'
					},
					{
						icon: 'box-archive',
						text: '领用审核',
						url: '/pagesA/item/goods/review'
					},
					{
						icon: 'box-archive',
						text: '归还审核',
						url: '/pagesA/item/goods/return'
					},
					{
						icon: 'box-archive',
						text: '库存记录',
						url: '/pagesA/item/goods/inventory'
					}
				],
			}
		},
		methods: {
			change(e) {
				let {
					index
				} = e.detail
				const url = this.list[index].url
				// //console.log("index", url)
				if (url) {
					uni.$router.to(url)
				}
			},
		}
	}
</script>

<style>
	.grid-item-box {
		flex: 1;
		// position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.item-icon {
		margin-bottom: 15rpx;
		transition: all 0.3s;
	}
</style>